package cn.ytzb.config;

import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author XiaoMo
 * @Date 2022/3/15 11:16
 * @Version 1.0
 */
@Configuration
public class MybatisConf {

    /**
     * mybatis框架配置
     * @return
     */

    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
        //引用容器里面的数据库的配置
        mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactoryBean");
        mapperScannerConfigurer.setBasePackage("cn.ytzb.mapper");
        return mapperScannerConfigurer;
    }
}
